package com.xdy.empty.controller;

import com.xdy.empty.bean.Book;
import com.xdy.empty.bean.Msg;
import com.xdy.empty.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class BookController {

    @Autowired
    private BookService bookService;

    @RequestMapping("/book")
    @ResponseBody
    public Msg getAllBook(){
        List<Book> bookList = bookService.getALl();
        return Msg.success().add("bookList",bookList);
    }
}
